import { http } from "@/utils/http/axios";
const baseProfix = "/resource/oss/config";

/**
 * 获取存储桶配置列表
 * @returns
 */
export function getPageList(params = {}) {
	return http.request<API.Response.BasicResponse>(
		{
			url: `${baseProfix}/page`,
			method: "GET",
			params
		},
		{
			isTransformResponse: false
		}
	);
}
// 根据ID查询
export function getConfig(id: number) {
	return http.request<API.Response.BasicResponse>({
		url: `${baseProfix}/${id}`,
		method: "GET"
	});
}
// 保存
export function save(params = {}) {
	return http.request<API.Response.BasicResponse>(
		{
			url: `${baseProfix}`,
			method: "POST",
			data: params
		},
		{
			isTransformResponse: false
		}
	);
}
//更新
export function update(params = {}) {
	return http.request<API.Response.BasicResponse>(
		{
			url: `${baseProfix}`,
			method: "PUT",
			data: params
		},
		{
			isTransformResponse: false
		}
	);
}
// 删除配置
export function remove(id: number | Array<number | undefined>) {
	return http.request<API.Response.BasicResponse>(
		{
			url: `${baseProfix}/${id}`,
			method: "DELETE"
		},
		{
			isTransformResponse: false
		}
	);
}
// 修改状态
export function changeStatus(params = {}) {
	return http.request<API.Response.BasicResponse>(
		{
			url: `${baseProfix}/changeStatus`,
			method: "PUT",
			data: params
		},
		{
			isTransformResponse: false
		}
	);
}
